﻿using System;

namespace FizzBuzz
{
    internal class LambdaDemo
    {
        internal delegate int Transformer(int i);

        public void Run()
        {
            // Func delegates in .net 3.5
            Func<int, int> square = x => x* x;
            Console.WriteLine(square(10));

            // lambda
            Transformer square2 = (int x) => x * x;
            Console.WriteLine(square2(10));

            // anonymous methods using delegates
            Transformer square3 = delegate(int i) { return i*i; };
            Console.WriteLine(square3(10));

        }
    }
}